extends FunctionCard

func _init() -> void:
	cost = 3
	card_id = "TiaoToTong"

func _ready() -> void:
	card_name = "条换筒"
	self_destruction = false
	self_description = "回合开始时,将所有的条子牌换成筒子牌"
	trigger_timing = 1
	label.text = card_name
	self_descrpition_label.text = self_description

func cardFunction(deck, scoreMapping, selectedCardsDetail):
	# 直接修改原始 deck 数组
	for i in range(deck.size()):
		var originalItem = deck[i]  # 保存原始值
		deck[i] = deck[i].replace("tiao", "tong")  # 修改原数组中的值
		# 如果被修改了，添加 "_CHANGEWANTOTONG" 后缀
		if deck[i] != originalItem:
			deck[i] = deck[i] + "_CHANGETIAOTOTONG"
	showRunDetail()
	run_detail.text = "条换筒!"
	await get_tree().create_timer(0.5).timeout  # 等待
	hideRunDetail()	
